package me.ereach.comparable;

import me.ereach.collections.EmailComparator;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        List<User> users = new ArrayList<>();

        users.add(new User("Tom", "e3", "male", 82));
        users.add(new User("Jerry", "e1", "male", 30));
        users.add(new User("Cindy", "e2", "female", 18));

        for (var x : users)
            System.out.println(x);

        System.out.println("===");

        Collections.sort(users);

        for (var x : users)
            System.out.println(x);

        System.out.println("===");

        Collections.sort(users, new EmailComparator());
        for (var x : users)
            System.out.println(x);
    }
}
